﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;

namespace GenericModels
{
    [DataContract (IsReference=false)]
    public abstract class Person 
    {
        private int cpr;
        private string address;
        private int postalCode;
        private string city;
        private string phoneNo;
        private string fName;
        private string lName;
        private string email;
       
        public Person()
        {
            this.cpr = 0;
            this.address = "Blank";
            this.phoneNo = "00000000";
            this.fName = "John";
            this.lName = "Doe";
            this.email = "n@a.dk";
            this.postalCode = 0;
            this.city = null;
            
        }


        public Person(int cpr, string address, string phoneNo, string fName, string lName, string email, string cityName, int postalCode)
        {
            this.cpr = cpr;
            this.address = address;
            this.phoneNo = phoneNo;
            this.lName = lName;
            this.fName = fName;
            this.email = email;
            this.city = cityName;
            this.postalCode = postalCode;
         }

        #region getters and setters
        [DataMember]
        public string Address
        {
            get { return address; }
            set { address = value; }
        }

        [DataMember]
        public string PhoneNo
        {
            get { return phoneNo; }
            set { phoneNo = value; }
        }

        [DataMember]
        public string FName
        {
            get { return fName; }
            set { fName = value; }
        }

        [DataMember]
        public string LName
        {
            get { return lName; }
            set { lName = value; }
        }

        [DataMember]
        public string Email
        {
            get { return email; }
            set { email = value; }
        }

        [DataMember]
        public string City
        {
            get { return city; }
            set { city = value; }
        }

        [DataMember]
        public int PostalCode
        {
            get { return postalCode; }
            set { postalCode = value; }
        }
        
        public virtual void GetInfo()
        {
            Console.WriteLine("cpr: {0}", cpr);
            Console.WriteLine("address: {0}", address);
            Console.WriteLine("phoneNo: {0}",phoneNo);
            Console.WriteLine("first name: {0}", fName);
            Console.WriteLine("last name: {0}", fName);
            Console.WriteLine("email: {0}", email);
            Console.WriteLine("city: {0}", city);
            Console.WriteLine("postal code: {0}", postalCode);
        }
        #endregion
    }
}
